﻿using System;

namespace ORM.Attribute
{
    [AttributeUsage(AttributeTargets.Class)]
    public class TableAttribute : System.Attribute
    {
        public TableAttribute()
        {
            _tableName = "";
            _tableType = TableEnum.TABLE;
            _description = "";
        }

	    public TableAttribute(string tableName)
	    {
            _tableName = tableName;
	        _tableType = TableEnum.TABLE;
	        _description = "";
	    }
        public TableAttribute(string dbAlias, string tableName, TableEnum tableType)
        {
            _dbAlias = dbAlias;
            _tableName = tableName;
            _tableType = tableType;
            _description = "";
        }
        public TableAttribute(string dbAlias, string tableName)
        {
            _dbAlias = dbAlias;
            _tableName = tableName;
            _tableType = TableEnum.TABLE;
            _description = "";
        }
        public TableAttribute(string tableName, TableEnum tableType)
        {
            _tableName = tableName;
            _tableType = tableType;
            _description = "";
        }
        public TableAttribute(string tableName, TableEnum tableType, string description)
        {
            _tableName = tableName;
            _tableType = tableType;
            _description = description;
        }
        private string _tableName;
        public virtual string TableName
        {
            get { return _tableName; }
            set { _tableName = value; }
        }

        private string _description = "";
        public virtual string Description
        {
            get { return _description; }
            set { _description = value; }
        }

        private string _primarykeys = "";
        public virtual string Primarykey
        {
            get { return _primarykeys ?? ""; }
            set { _primarykeys = value; }
        }

        private TableEnum _tableType = TableEnum.TABLE;
        public virtual TableEnum TableType
        {
            get { return _tableType; }
            set { _tableType = value; }
        }

        private string _dbAlias = "";
        public virtual string DbAlias
        {
            get { return _dbAlias; }
            set { _dbAlias = value; }
        }

    }
    [Flags]
    public enum TableEnum
    {
        TABLE = 0x0000,
        PROCEDURE = 0x0002
    }

}
